﻿#region Development Information
//====================================================== 
// Log Handler Class

//====================================================== 

// Created By : Kunal Uppal

// Created Date : 10th January, 2011

// Purpose : Class Exposes properties for various configuration setting of Logging

// Description : Used by LoggerUtility class to check what all logging policies are enabled in the system

//====================================================== 
#endregion

#region References
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Configuration;
#endregion

#region Implementation
namespace ALog.Logging
{
   internal static class LogHandler
   {
       #region StaticProperties
       /// <summary>
       /// Checks Whether Database Logging is Enabled or Not
       /// </summary>
       public static bool IsDatabaseLoggingEnabled
       {
           get
           {
               if (ConfigurationManager.AppSettings["DatabaseLoggingPolicyEnabled"] != null)
               {
                   return Convert.ToBoolean(ConfigurationManager.AppSettings["DatabaseLoggingPolicyEnabled"].ToString());
               }
               else
               {
                   return false;
               }
           }
       }
       /// <summary>
       /// Checks Whether Rolling file Logging is Enabled or Not
       /// </summary>
       public static bool IsRollingFileLoggingEnabled
       {
           get
           {
               if (ConfigurationManager.AppSettings["RollingFilePolicyEnabled"] != null)
               {
                   return Convert.ToBoolean(ConfigurationManager.AppSettings["RollingFilePolicyEnabled"].ToString());
               }
               else
               {
                   return false;
               }
           }
       }
       /// <summary>
       /// Checks whether Event file logging is enabled or not
       /// </summary>
       public static bool IsEventFileLoggingEnabled
       {
           get
           {
               if (ConfigurationManager.AppSettings["EventLoggingPolicyEnabled"] != null)
               {
                   return Convert.ToBoolean(ConfigurationManager.AppSettings["EventLoggingPolicyEnabled"].ToString());
               }
               else
               {
                   return false;
               }
           }

       }
       /// <summary>
       /// Ready Only, Gets Boolean value indicating whether XML File Logging is Enabled
       /// </summary>
       public static bool IsXMLFileLoggingEnabled
       {
           
           get
           {
               if (ConfigurationManager.AppSettings["XMLLoggingPolicyEnabled"] != null)
               {
                   return Convert.ToBoolean(ConfigurationManager.AppSettings["EventLoggingPolicyEnabled"].ToString());
               }
               else
               {
                   return false;
               }
           }
       }
       /// <summary>
       /// Ready Only, Gets Boolean value indicating whether Email Logging is Enabled
       /// </summary>
       public static bool IsEmailLoggingEnabled
       {
           get
           {
               if (ConfigurationManager.AppSettings["EmailLoggingPolicyEnabled"] != null)
               {
                   return Convert.ToBoolean(ConfigurationManager.AppSettings["EmailLoggingPolicyEnabled"].ToString());
               }
               else
               {
                   return false;
               }
           }
       }

       /// <summary>
       /// Read only, Gets Boolean value indicating whether exception logging is enabled or not
       /// </summary>
       public static bool IsExceptionLoggingEnabled
       {
           get
           {
               if (ConfigurationManager.AppSettings["ExceptionLoggingEnabled"] != null)
               {
                   return Convert.ToBoolean(ConfigurationManager.AppSettings["ExceptionLoggingEnabled"].ToString());
               }
               else
               {
                   return false;
               }
           }

       }
       #endregion

   }
}
#endregion